--[[=========================================================
	GAMEMODE FUNCTIONS
=========================================================]]--

--[[-----------------------------------------------------]]--
--	Sets the player's remaining energy for client-side use
--[[-----------------------------------------------------]]--
function GM:SetPlayerEnergy( ply, val )

	ply:SendLua( "player.GetByID( " .. tostring( ply:EntIndex() ) .. " ):SetEnergy( " .. tostring( val ) .. " )" )

end

--[[-----------------------------------------------------]]--
--	Sets the player's remaining stealth for client-side use
--[[-----------------------------------------------------]]--
function GM:SetPlayerStealth( ply, val )

	ply:SendLua( "player.GetbyID( " .. tostring( ply:EntIndex() ) .. " ):SetStealth( " .. tostring( val ) .. " )" )

end

--[[-----------------------------------------------------]]--
--	Notifies a player that a server cvar has changed
--[[-----------------------------------------------------]]--
function GM:NotifyPlayerServerVarChanged( ply, cvar, prev, n )

	local cmd		= "player.GetByID( " .. tostring( ply:EntIndex() ) .. " ):ServerCVarChanged( \"" .. tostring( cvar ) .. "\", " .. tostring( prev ) .. ", " .. tostring( n ) .. " )"
	DEBUG:Msg( "Notifying " .. ply:Nick() .. ": " .. tostring( cvar ) .. ": " .. tostring( prev ) .. " -> " .. tostring( n ) )
	ply:SendLua( "player.GetByID( " .. tostring( ply:EntIndex() ) .. " ):ServerCVarChanged( \"" .. tostring( cvar ) .. "\", " .. tostring( prev ) .. ", " .. tostring( n ) .. " )" )

end